Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Add support for editing prebuilt rules to the Rule Editing page #199550

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

dplumlee
Copy link
Contributor

@dplumlee dplumlee commented Nov 8, 2024

Resolves: #180172

Summary

Note

Feature is behind the prebuiltRulesCustomizationEnabled feature flag.

Removes the logic gates preventing prebuilt rules from being edited via the Rule Edit page behind the prebuiltRulesCustomizationEnabled feature flag. This allows all rules types to be fully editable via the UI.

Also removes the muting logic we had in place for Definition tab warnings (implemented here)

Screenshots

Before

Prebuilt rule only has the "Actions" tab enabled, users cannot customize anything else in the form
Screenshot 2024-11-08 at 3 08 15 PM

After

Prebuilt rule now has all tabs/fields available for editing and rule info is populated into the form
Screenshot 2024-11-08 at 3 02 43 PM

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@dplumlee dplumlee added release_note:skip Skip the PR/issue when compiling release notes v9.0.0 Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area v8.17.0 labels Nov 8, 2024
@dplumlee dplumlee self-assigned this Nov 8, 2024
@dplumlee dplumlee marked this pull request as ready for review November 12, 2024 16:03
@dplumlee dplumlee requested a review from a team as a code owner November 12, 2024 16:03
@dplumlee dplumlee requested a review from dhurley14 November 12, 2024 16:03
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@dplumlee dplumlee requested a review from banderror November 12, 2024 16:28
@dplumlee dplumlee added the backport:version Backport to applied version labels label Nov 12, 2024
Copy link
Contributor

@dhurley14 dhurley14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small nit I feel checking for false equivalency doesn't read as nicely as checking for not enabled.

@banderror
Copy link
Contributor

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 13.4MB 13.4MB +50.0B

History

cc @dplumlee

Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with a few prebuilt rules with the feature flag ON, one of them was the Member Removed From GitHub Organization rule.

I can confirm that the following use cases work on the Rule Editing page:

  • All the tabs are enabled and available for editing: Definition, About, Schedule, Actions.
  • It's NOT possible to change the rule type.
  • Possible to customize index patterns.
  • Possible to customize EQL query.
  • The non-blocking data validation works: we show that "This rule has validation errors" modal window if certain fields or indices are missing, and it's still possible to save the rule.
  • Possible to customize related integrations.
  • Possible to customize Timeline template.
  • Possible to customize rule name.
  • Possible to customize description.
  • Possible to customize default severity.
  • Possible to customize default risk score.
  • Possible to customize schedule.
  • Possible to edit rule actions.

Testing of the Rule Editing page with the flag OFF was done right before that here.

The only issue I keep noticing is that almost any attempt to customize a prebuilt rule marks it as customized, even in the cases when it shouldn't. I guess this is the same bug as #199629. For example:

  • When you edit a prebuilt rule, change nothing, and save it.
  • When you bulk add rule actions. With some prebuilt rules it works correctly, with some of them it doesn't.

We will need to do more thorough per-field manual testing, and also cover each field with tests, when we start working on test plans.

But this PR as is LGTM and the code changes too 👍

Thank you @dplumlee! 🚢

@dplumlee dplumlee merged commit d6e6145 into elastic:main Nov 13, 2024
46 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11827345940

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 13, 2024
…e Editing page (elastic#199550)

**Resolves: elastic#180172

## Summary

> [!NOTE]
> Feature is behind the `prebuiltRulesCustomizationEnabled` feature
flag.

Removes the logic gates preventing prebuilt rules from being edited via
the Rule Edit page behind the `prebuiltRulesCustomizationEnabled`
feature flag. This allows all rules types to be fully editable via the
UI.

Also removes the muting logic we had in place for `Definition` tab
warnings ([implemented
here](elastic#191487))

### Screenshots

#### _Before_

**Prebuilt rule only has the "Actions" tab enabled, users cannot
customize anything else in the form**
![Screenshot 2024-11-08 at 3 08
15 PM](https://github.com/user-attachments/assets/b83836e6-f78f-4b3a-9fbc-55a5208250dd)

#### _After_

**Prebuilt rule now has all tabs/fields available for editing and rule
info is populated into the form**
![Screenshot 2024-11-08 at 3 02
43 PM](https://github.com/user-attachments/assets/184f6fc4-b64c-4e20-a987-76e460c61786)

### Checklist

Delete any items that are not applicable to this PR.

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit d6e6145)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@dplumlee dplumlee deleted the allow-prebuilt-rule-edit-form branch November 13, 2024 23:20
kibanamachine added a commit that referenced this pull request Nov 14, 2024
…he Rule Editing page (#199550) (#200106)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Add support for editing prebuilt rules to the
Rule Editing page
(#199550)](#199550)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Davis
Plumlee","email":"56367316+dplumlee@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-13T23:04:38Z","message":"[Security
Solution] Add support for editing prebuilt rules to the Rule Editing
page (#199550)\n\n**Resolves:
https://github.com/elastic/kibana/issues/180172**\r\n\r\n##
Summary\r\n\r\n> [!NOTE] \r\n> Feature is behind the
`prebuiltRulesCustomizationEnabled` feature\r\nflag.\r\n\r\nRemoves the
logic gates preventing prebuilt rules from being edited via\r\nthe Rule
Edit page behind the `prebuiltRulesCustomizationEnabled`\r\nfeature
flag. This allows all rules types to be fully editable via
the\r\nUI.\r\n\r\nAlso removes the muting logic we had in place for
`Definition` tab\r\nwarnings
([implemented\r\nhere](https://github.com/elastic/kibana/pull/191487))\r\n\r\n###
Screenshots\r\n\r\n#### _Before_\r\n\r\n**Prebuilt rule only has the
\"Actions\" tab enabled, users cannot\r\ncustomize anything else in the
form**\r\n![Screenshot 2024-11-08 at 3
08\r\n15 PM](https://github.com/user-attachments/assets/b83836e6-f78f-4b3a-9fbc-55a5208250dd)\r\n\r\n\r\n####
_After_\r\n\r\n**Prebuilt rule now has all tabs/fields available for
editing and rule\r\ninfo is populated into the form**\r\n![Screenshot
2024-11-08 at 3
02\r\n43 PM](https://github.com/user-attachments/assets/184f6fc4-b64c-4e20-a987-76e460c61786)\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"d6e6145dacf25bf3e900611425434b0713bce005","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v8.17.0"],"title":"[Security Solution] Add
support for editing prebuilt rules to the Rule Editing
page","number":199550,"url":"https://github.com/elastic/kibana/pull/199550","mergeCommit":{"message":"[Security
Solution] Add support for editing prebuilt rules to the Rule Editing
page (#199550)\n\n**Resolves:
https://github.com/elastic/kibana/issues/180172**\r\n\r\n##
Summary\r\n\r\n> [!NOTE] \r\n> Feature is behind the
`prebuiltRulesCustomizationEnabled` feature\r\nflag.\r\n\r\nRemoves the
logic gates preventing prebuilt rules from being edited via\r\nthe Rule
Edit page behind the `prebuiltRulesCustomizationEnabled`\r\nfeature
flag. This allows all rules types to be fully editable via
the\r\nUI.\r\n\r\nAlso removes the muting logic we had in place for
`Definition` tab\r\nwarnings
([implemented\r\nhere](https://github.com/elastic/kibana/pull/191487))\r\n\r\n###
Screenshots\r\n\r\n#### _Before_\r\n\r\n**Prebuilt rule only has the
\"Actions\" tab enabled, users cannot\r\ncustomize anything else in the
form**\r\n![Screenshot 2024-11-08 at 3
08\r\n15 PM](https://github.com/user-attachments/assets/b83836e6-f78f-4b3a-9fbc-55a5208250dd)\r\n\r\n\r\n####
_After_\r\n\r\n**Prebuilt rule now has all tabs/fields available for
editing and rule\r\ninfo is populated into the form**\r\n![Screenshot
2024-11-08 at 3
02\r\n43 PM](https://github.com/user-attachments/assets/184f6fc4-b64c-4e20-a987-76e460c61786)\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"d6e6145dacf25bf3e900611425434b0713bce005"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199550","number":199550,"mergeCommit":{"message":"[Security
Solution] Add support for editing prebuilt rules to the Rule Editing
page (#199550)\n\n**Resolves:
https://github.com/elastic/kibana/issues/180172**\r\n\r\n##
Summary\r\n\r\n> [!NOTE] \r\n> Feature is behind the
`prebuiltRulesCustomizationEnabled` feature\r\nflag.\r\n\r\nRemoves the
logic gates preventing prebuilt rules from being edited via\r\nthe Rule
Edit page behind the `prebuiltRulesCustomizationEnabled`\r\nfeature
flag. This allows all rules types to be fully editable via
the\r\nUI.\r\n\r\nAlso removes the muting logic we had in place for
`Definition` tab\r\nwarnings
([implemented\r\nhere](https://github.com/elastic/kibana/pull/191487))\r\n\r\n###
Screenshots\r\n\r\n#### _Before_\r\n\r\n**Prebuilt rule only has the
\"Actions\" tab enabled, users cannot\r\ncustomize anything else in the
form**\r\n![Screenshot 2024-11-08 at 3
08\r\n15 PM](https://github.com/user-attachments/assets/b83836e6-f78f-4b3a-9fbc-55a5208250dd)\r\n\r\n\r\n####
_After_\r\n\r\n**Prebuilt rule now has all tabs/fields available for
editing and rule\r\ninfo is populated into the form**\r\n![Screenshot
2024-11-08 at 3
02\r\n43 PM](https://github.com/user-attachments/assets/184f6fc4-b64c-4e20-a987-76e460c61786)\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"d6e6145dacf25bf3e900611425434b0713bce005"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Nov 18, 2024
…e Editing page (elastic#199550)

**Resolves: elastic#180172

## Summary

> [!NOTE]  
> Feature is behind the `prebuiltRulesCustomizationEnabled` feature
flag.

Removes the logic gates preventing prebuilt rules from being edited via
the Rule Edit page behind the `prebuiltRulesCustomizationEnabled`
feature flag. This allows all rules types to be fully editable via the
UI.

Also removes the muting logic we had in place for `Definition` tab
warnings ([implemented
here](elastic#191487))

### Screenshots

#### _Before_

**Prebuilt rule only has the "Actions" tab enabled, users cannot
customize anything else in the form**
![Screenshot 2024-11-08 at 3 08
15 PM](https://github.com/user-attachments/assets/b83836e6-f78f-4b3a-9fbc-55a5208250dd)


#### _After_

**Prebuilt rule now has all tabs/fields available for editing and rule
info is populated into the form**
![Screenshot 2024-11-08 at 3 02
43 PM](https://github.com/user-attachments/assets/184f6fc4-b64c-4e20-a987-76e460c61786)

### Checklist

Delete any items that are not applicable to this PR.

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios



### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Nov 18, 2024
…e Editing page (elastic#199550)

**Resolves: elastic#180172

## Summary

> [!NOTE]  
> Feature is behind the `prebuiltRulesCustomizationEnabled` feature
flag.

Removes the logic gates preventing prebuilt rules from being edited via
the Rule Edit page behind the `prebuiltRulesCustomizationEnabled`
feature flag. This allows all rules types to be fully editable via the
UI.

Also removes the muting logic we had in place for `Definition` tab
warnings ([implemented
here](elastic#191487))

### Screenshots

#### _Before_

**Prebuilt rule only has the "Actions" tab enabled, users cannot
customize anything else in the form**
![Screenshot 2024-11-08 at 3 08
15 PM](https://github.com/user-attachments/assets/b83836e6-f78f-4b3a-9fbc-55a5208250dd)


#### _After_

**Prebuilt rule now has all tabs/fields available for editing and rule
info is populated into the form**
![Screenshot 2024-11-08 at 3 02
43 PM](https://github.com/user-attachments/assets/184f6fc4-b64c-4e20-a987-76e460c61786)

### Checklist

Delete any items that are not applicable to this PR.

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios



### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area release_note:skip Skip the PR/issue when compiling release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security Solution] Add support for editing prebuilt rules to the Rule Editing page
5 participants